﻿@model PaginationList<iHouse.Model.Data.Book>


<ul id="shelf" ng-controller="bookController" ng-init="">
    @*@foreach (iHouse.Model.Data.Book bookReview in this.Model)
        {
            <li class="box">
                <div class="postim">
                    <span class="inwriter">@bookReview.Name</span>
                    @{string detailLink = Url.Action("Detail", "Book", new { bookID = bookReview.ID });
                    string imgSrc = string.Empty;
                    if (!System.String.IsNullOrEmpty(bookReview.ImagePath))
                    {
                        imgSrc = UrlHelper.GenerateContentUrl(bookReview.ImagePath, this.ViewContext.HttpContext);
                    }

                    <a href="@detailLink" class='detailModal'>
                        <img class="bookcover" alt="" src="@imgSrc" />
                    </a>
            if (Request.IsAuthenticated)
            {
                string editLink = Url.Action("Edit", "Book", new { bookID = bookReview.ID, category = this.ViewBag.SelectedCategory, page = this.ViewBag.CurrentPage });
                string uploadLink = Url.Action("Upload", "Book", new { bookID = bookReview.ID });

                <div class="img-controller">
                    <a class="img-edit" href="@editLink"></a>
                    <a class="img-upload" href="@uploadLink"></a>
                    <a class="img-del" href="javascript:void(0)" onclick="HandleBookDelete('@bookReview.ID','@this.ViewBag.SelectedCategory','@this.ViewBag.CurrentPage')" title="@Resources.DeleteAction"></a>
                </div>
            }
                    }
                </div>
            </li>
        }*@
    <li class="box" ng-repeat="bookReview in books">
        <div class="postim">
            <span class="inwriter">{{bookReview.Name}} </span>
            <a href="{{bookReview.DetailLink}}" class='detailModal'>
                <img class="bookcover" alt="" ng-src="{{bookReview.ImagePath}}" />
            </a>
            <div class="img-controller" ng-show="isAuthenticated">
                <a class="img-edit" href="{{bookReview.EditLink}}"></a>
                <a class="img-upload" href="{{bookReview.uploadLink}}"></a>
                <a class="img-del" href="javascript:void(0)" ng-click="" title="@Resources.DeleteAction"></a>
            </div>
        </div>
    </li>
</ul>

<script type="text/javascript">
    function HandleBookDelete(id, categoryID, pageIndex) {
        if ('@System.Threading.Thread.CurrentThread.CurrentUICulture.Name' == "zh-CN") {
            Sys.require(["iHouse.Culture.cn"]);
        }

        Sys.require(["BookUI", "jqUI"], function () { DeleteBook(id, categoryID, pageIndex); });
    }

    Sys.require(["BookUI", "colorbox", "jQuery"], function () { InitBookCover(); InitBookModals(); });
</script>